package com.tianquan.DistributedLock.entiy;

import lombok.Data;

import java.io.Serial;
import java.io.Serializable;

/**
 * @author 天权
 * @TableName lock
 */
@Data
public class Lock implements Serializable {

    /**
     * 名称
     */
    private String lockName;

    /**
     * 重入次数
     */
    private Integer value;

    /**
     * 持有锁的线程id
     */
    private Long thread;

    /**
     * 过期时间
     */
    private Long expirationTime;

    @Serial
    private static final long serialVersionUID = 1L;

    public Lock(String lockName, Long thread, Long expirationTime) {
        this.lockName = lockName;
        this.expirationTime = expirationTime;
        this.thread = thread;
    }

    public static Lock createLock(String lockName,Long thread, Long expirationTime){
        return new Lock(lockName, thread, expirationTime);
    }

}